<template>
	<view>
		<view class="content">
			<view class="list" v-for="(item,index) in list" :key="index">
				<image src="../static/jindou6.png" v-if="item.flag=='IN'" class="head"></image>
				<image src="../static/jindou7.png" v-else class="head"></image>
				<view class="view">
					<view class="name">
						<text>类型</text> {{item.name}}({{item.title}})
					</view>
					<view class="telphone">
						<text>时间</text> {{item.time}}
					</view>
				</view>
				<view v-if="item.flag=='IN'" class="number add">
					+{{item.change}}
				</view>
				<view v-else class="number sub">
					-{{item.change}}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	var than;
	export default {
		data() {
			return {
				list: [],
			}
		},
		onLoad(option) {
			than = this;
			than.getList();
		},
		onReachBottom() {
			than.page++
			than.getList();
		},
		methods: {
			getList() {
				than.post("api/Goldbean/useNewList", {
					page: than.page
				}, function(data) {
					for (let i in data) {
						var d = data[i]
						switch (d.type) {
							case 'SERVICE_KMB_YUYUE':
								d.name = "兑换蜂巢消耗"
								break;
							case 'SERVICE_KMB_DIRECT':
								d.name = "兑换蜂巢消耗"
								break;
							case 'BUY_MEMBER_CARD':
								d.name = "购买会员卡"
								break;
							case 'TRANSFER_KMB':
								d.name = "出兑蜜贝"
								break;
							case 'INVITE_MEMBER':
								d.name = "邀请奖励"
								break;
							case 'MANUAL_CHANGE_ADMIN':
								d.name = "兑换奖励"
								break;
							case 'APPOINTMENT':
								d.name = "预约消耗"
								break;
							case 'RETURN_APPOINTMENT':
								d.name = "预约返还"
								break;
							case 'TRANSFER_KMB_FAIL':
								d.name = "兑换蜜贝失败"
								break;
							case 'EXCHANGE_GDB_TICKET':
								d.name = "兑换金蜜券"
								break;
							case 'TRANSFER_KMB_FAIL':
								d.name = "兑换失败返还"
								break;
							case 'HAND_OUT_GDB_TICKET':
								d.name = "派发金蜜券"
								break;
							case 'EXCHANGE_GDB_GOODS':
								d.name = "兑换蜂巢"
								break;
							case 'ADMIN_HAND_OUT_GDB_TICKET':
								d.name = "兑换金蜜券"
								break;
							case 'INVITE_BUY_GOODS_GIVE':
								d.name = "推荐奖励"
								break;
							case 'EXCHANGE_GDB_GOODS':
								d.name = "兑换蜂巢"
								break;
							case 'ONSALE_GOODS_MORE':
								d.name = "挂卖蜂巢"
								break;
							case 'MANAGE_GIVE':
								d.name = "补偿"
								break;
							case 'INVITE_NEW_FRIEND_BUY_GOODS_GI':
								d.name = "分享礼"
								break;
							default:
								d.name = "未知"
								break;
						}
					}
					if (than.page == 1) {
						than.list = data;
					} else {
						than.list = than.list.concat(data)
					}
				})
			},
		}
	}
</script>

<style lang="less">
	.content {
		padding: 36rpx;

		.title {
			height: 106rpx;
			line-height: 106rpx;
			font-size: 32rpx;
			font-family: PingFang SC;
			font-weight: bold;
			color: #333333;
		}

		.list {
			padding: 0 24rpx;
			margin-bottom: 24rpx;
			height: 200rpx;
			background: #FFFFFF;
			border-radius: 20rpx;
			display: flex;
			align-items: center;

			.head {
				width: 99rpx;
				height: 99rpx;
			}

			.view {
				margin-left: 20rpx;

				.name {
					margin-right: 10rpx;
					font-size: 30rpx;
					font-family: PingFang SC;
					font-weight: bold;
					color: #333333;
					margin-bottom: 20rpx;

				}

				text {
					font-size: 30rpx;
					font-family: PingFang SC;
					font-weight: bold;
					color: #666666;
					margin-right: 20rpx;
				}

				.telphone {
					font-size: 28rpx;
					font-family: PingFang SC;
					font-weight: 500;
					color: #999999;
				}
			}

			.number {
				margin-left: auto;

				font-size: 40rpx;
				font-family: DINCond-Black;
				font-weight: 400;

			}

			.add {
				color: #F46813;
			}

			.sub {
				color: #1B1B1D;
			}

		}
	}

	page {
		background: #FAFAFA;
	}
</style>
